﻿#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>
/// 设置SpriteAtlas
/// </summary>
public class EditorWindowSpriteAtlas : AbsESF_EditorWindow
{
    /// <summary>
    /// 节点组
    /// </summary>
    static List<ESF_CollectAsset_Sprite> mNodes = null;

    protected override AbsESF_EditorBuildAsset config => ESF_Logic.spriteAtlasSettingFolder;

    /// <summary>
    /// OnGUI
    /// </summary>
    protected override void OnRunGUI()
    {
        if (GUILayout.Button(ESF_enGUIDisplayWord.Save.ESF_ToAlias()))
        {
            OnSaveConfig();
        }
        if (GUILayout.Button(ESF_enGUIDisplayWord.Load.ESF_ToAlias()))
        {
            mNodes = ESF_Logic.CollectSprite<ESF_CollectAsset_Sprite>();
            ESF_Utility.ExecuteMenuAssetsRefresh();
        }
        if (mNodes != null)
        {            
            EditorGUILayout.LabelField($"Sprite图片数量：{mNodes.Count}");            
        }        

        if (GUILayout.Button($"{ESF_enGUIDisplayWord.Build.ESF_ToAlias()} SpriteAtlas"))
        {
            ESF_Logic.BuildSpriteAtlas();
        }

        if (GUILayout.Button($"{ESF_enGUIDisplayWord.OneKeyBuild.ESF_ToAlias()} SpriteAtlass"))
        {
            ESF_Logic.OneKeyBuildSpriteAtlas();
        }
    }
}
#endif
